<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="<c:url value='/css/style.css'/>" rel="stylesheet" type="text/css"/>
<fmt:setBundle basename="Messages_en" />
<c:set var="t" value="true" />
<title><fmt:message key="title.staff"/> </title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<script type="text/javascript">
$.validator.addMethod("custom_number", function(value, element) {
    return this.optional(element) || value === "NA" || 
        value.match(/^[6-9]\d{7}$/);
}, "Enter valid contact number");

  $(document).ready(function(){
    $("#setupstaff").validate({
        rules: {
            contactNo: {
                required: true,
                custom_number: true,
                minlength: 8
            },
    		reportTo: {
				required: true,
				digits: true,
                minlength: 8
			}
		
        }
    });
  });
</script>
</head>
<body>
<%@ include file="header.jsp" %>
<table>
<tr>
<td width=15%></td>
<td class="menuborder" width=20%>
<table id="head">
			<tr>
<!-- 				<td><h2 id="header">ISS Facilities Booking</h2></td> -->
				<td>
<!-- 				<input type="hidden" name="welcome" id="show_greeting" /> -->
				<c:if test="${!empty sessionScope.LoggedinUser.username}">
				<h5>Welcome ${sessionScope.LoggedinUser.username}</h5>
				</c:if>
				</td>
			</tr>
		</table>
		<table id="content">
			<tr>
				<td><h2 id="header">MENU</h2></td>
			</tr>
			<tr>
				<td><a href="MakeABooking.jsp">Make a Booking</a></td>
			</tr>
			<tr>
				<td><a href="BookDetailsController">View Booking Details</a></td>
			</tr>
			<tr>
				<td><a href="BookingHistoryController">View Booking History</a></td>
			</tr>
			<tr>
				<td><a href="ManageStaff.jsp">Manage Staff</a></td>
			</tr>
			<tr>
				<td><a href="LoadFacility">Manage Facilities</a></td>
			</tr>
			<tr>
				<td><a href="Login.jsp">Sign Out</a>
				
				</td>
			</tr>
		</table>
</td>
<td class=2%></td>
<td width=53%>
<form action="/JavaCA/staffprocess" method=post id="setupstaff">
<center>
<fieldset>
<legend><fmt:message key="setup.staff"/></legend>
<table cellpadding=4 cellspacing=2 border=0>
<tr>
<td class="positionright"><fmt:message key="setup.staff.name"/></td>
<td class="positionleft">
<c:if test="${param['insert']==t}" >
<span>*</span><input type="text" name="username" value="${param['username']}" size=15 maxlength=30 class="required">
<input type="hidden" name="ins" value="true" />
</c:if>
<c:if test="${param['update']==t}" >
<input type="text" name="username" value="${param['username']}" size=15 maxlength=30 readonly="readonly">
<input type="hidden" name="ins" value="false" />
<input type="hidden" name="userId" value="${param['userId']}">
</c:if>
</td>
</tr>
<tr>
<td class="positionright"><fmt:message key="setup.staff.role"/> </td>
<td class="positionleft">
<c:if test="${param['insert']==t}" >
<input type="radio" name="role" value="Staff" checked><fmt:message key="setup.staff.role.1"/>
<input type="radio" name="role" value="Manager"><fmt:message key="setup.staff.role.2"/>
<input type="radio" name="role" value="Admin"><fmt:message key="setup.staff.role.3"/>
<input type="hidden" name="ins" value="true" />
</c:if>
<c:if test="${param['update']==t}" >
<input type="radio" name="role" value="Staff" ${ param['role'] == "Staff" ? 'checked="checked"' : '' } /><fmt:message key="setup.staff.role.1"/>
<input type="radio" name="role" value="Manager" ${ param['role'] == "Manager" ? 'checked="checked"' : '' } /><fmt:message key="setup.staff.role.2"/>
<input type="radio" name="role" value="Admin" ${ param['role'] == "Admin" ? 'checked="Admin"' : '' } /><fmt:message key="setup.staff.role.3"/>
<input type="hidden" name="ins" value="false" />
</c:if>
</td>
</tr>
<tr>
<td class="positionright"><fmt:message key="setup.staff.contact"/></td>
<td class="positionleft">
<span>*</span><input type="text" name="contactNo" value="${param['contactNo']}" size=15 maxlength=8></td>
</tr>
<tr>
<td class="positionright"><fmt:message key="setup.staff.email"/></td>
<td class="positionleft">
<span>*</span><input type="text" name="email" value="${param['email']}" size=15 maxlength=40 class="required email"></td>
</tr>
<tr>
<td class="positionright"><fmt:message key="setup.staff.report"/></td>
<td class="positionleft">
<span>*</span><input type="text" name="reportTo" value="${param['reportTo']}" size=15 maxlength=8></td>
</tr>
</table>
<input type="submit" value="Submit">
</fieldset>
</center>
</form>
</td>
<td width=10%></td>
</tr>
</table>
<%@ include file="footer.jsp" %>
</body>
</html>